package cn.iocoder.yudao.module.nginxui.dal.mysql.globalblock;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.nginxui.dal.dataobject.globalblock.GlobalBlockDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.nginxui.controller.admin.globalblock.vo.*;

/**
 * Nginx全局块配置 Mapper
 *
 * @author HuangJunZhong
 */
@Mapper
public interface GlobalBlockMapper extends BaseMapperX<GlobalBlockDO> {

    default PageResult<GlobalBlockDO> selectPage(GlobalBlockPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GlobalBlockDO>()
                .eqIfPresent(GlobalBlockDO::getConfigId, reqVO.getConfigId())
                .eqIfPresent(GlobalBlockDO::getDirective, reqVO.getDirective())
                .eqIfPresent(GlobalBlockDO::getValue, reqVO.getValue())
                .eqIfPresent(GlobalBlockDO::getDescription, reqVO.getDescription())
                .eqIfPresent(GlobalBlockDO::getSort, reqVO.getSort())
                .eqIfPresent(GlobalBlockDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(GlobalBlockDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(GlobalBlockDO::getId));
    }

}